/*
 * AVideFaceObstacle.cpp
 *
 *  Created on: 12 nov. 2012
 *      Author: guegan
 */

#include "AVideFaceObstacle.h"

AVideFaceObstacle* AVideFaceObstacle::_instance;

void AVideFaceObstacle::tourner(string direction){
	if (!(direction == "N" || direction == "E" || direction == "O" || direction == "S"))
		throw EtatRobot::TournerException();

	robot->setEtatRobot(EtatRobot::getEtatRobot("AVide"));

	robot->setDirection(direction);

	if( robot->getObstacle() != NULL )
		robot->setObstacle(NULL);

}

int AVideFaceObstacle::evaluerObstacle() {
	return robot->getObstacle()->getHauteur();
}

void AVideFaceObstacle::saisir(Objet o) {
	robot->setEtatRobot(EtatRobot::getEtatRobot("EnChargeFaceObstacle"));

	robot->setObjet(&o);
}

AVideFaceObstacle* AVideFaceObstacle::instance(){
    if(_instance == NULL)
          _instance = new AVideFaceObstacle("AVideFaceObstacle");

    return _instance;
}

AVideFaceObstacle::~AVideFaceObstacle() {
	_instance = NULL;
}
